JBoss Community Archive (Read Only)

PicketLink

PicketLink IDM - Role Management

This page will describe the API for managing roles.

Role Management (CRUD Operations)

Create Roles

//Create a Role instance as object
Role newRoleInstance = new SimpleRole("someRole");

// let's create the new role
identityManager.add(newRoleInstance);

// let's retrieve the role information and see if they are properly stored
Role storedRoleInstance = identityManager.getRole(newRoleInstance.getName());

assertNotNull(storedRoleInstance);

assertEquals(newRoleInstance.getKey(), storedRoleInstance.getKey());
assertEquals(newRoleInstance.getName(), storedRoleInstance.getName());

Update Roles

If we have a Role instance called "role" and we need to update what is stored in the IdentityStore, we use the updateRole method on the IdentityManager.

identityManager.update(role);

Remove Roles

Group storedGroupInstance =identityManager.getGroup("Test Group");
Role storedRoleInstance = identityManager.getRole("Administrator");

assertNotNull(storedRoleInstance);

identityManager.remove(storedRoleInstance);

Role removedRoleInstance = identityManager.getRole("Administrator");

assertNull(removedRoleInstance);
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:19:14 UTC, last content change 2012-12-14 22:23:00 UTC.